﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using AnimalFight.Lib.Interface;
using AnimalFight.Lib.EventHandlers;

namespace AnimalFight.Lib.Data
{
    public class Dog : AnimalBase, IAttack, IDefense
    {
        public event AttackDelegate AttackEvent;
        public event DefenseDelegate DefenseEvent;

        public bool IsDefending
        {
            get;
            set;
        }

        public DogMood _mood
        {
            get {return _mood; }
            set { _mood = value; }
        }

        public void Attack(Animals target)
        {
            int theRealAttackPower = 0;

            if (this._mood == DogMood.Bad)
            {
                theRealAttackPower = (int) (0.5 * this.AP);
            }
            else
            {
                theRealAttackPower = this.AP;
            }

            if (AttackEvent !=null)
            {
                AttackEventHandler eventHandler = new AttackEventHandler
                {
                    AP = theRealAttackPower,
                    Target = target
                };

                AttackEvent(this, eventHandler);
            }
        }
        

        public void Defense()
        {
            throw new NotImplementedException();
        }

    }

    public enum DogMood {Good, Bad}
}
